import "crvpuppet"

define at3_headnode_kshttpd($webaddr="", $roleid="", $extrarules="") {
  if $AutoMode==true and $CloudCRV==true {
    #Need to get these vars
    #define $ethgreen $ethred $domasq $extrarules
  }
  
  if ( $AutoMode == false ) or ( $AutoMode==true and $CloudCRV==true ) {

    file { "/etc/httpd/conf.d/ks.conf":
      owner => "root",
      group => "root",
      mode => 644,
      content => template("at3_headnode_kshttpd/ks.conf.tpl"),
      notify => Service["httpd"]
    }

    package { "httpd":
      ensure => installed,
    }
    
    service { "httpd":
      hasstatus => true,
      hasrestart => true,
      ensure => running,
      enable => true,
      require => [Package["httpd"],File["/etc/httpd/conf.d/ks.conf"]]
    }
  }
  
  if $AutoMode==true and $CloudCRV==true {
    set_role_attr($webaddr,$roleid,"ProfileApplied","True")
  }
}

